package com.david.IfaceAutoTest.utils;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

/**
 * PostMan Json文件格式测试类
 *
 * @author david
 * @version 1.0
 * @date 2021/12/2411:17
 */
public class PostMainJson {
    public static void main(String[] args) {
        String str="{\n" +
                "\t\"info\": {\n" +
                "\t\t\"_postman_id\": \"2aaeb03a-ebfc-411c-856e-ed7820418092\",\n" +
                "\t\t\"name\": \"奥迪项目\",\n" +
                "\t\t\"schema\": \"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\"\n" +
                "\t},\n" +
                "\t\"item\": [\n" +
                "\t\t{\n" +
                "\t\t\t\"name\": \"奥迪\",\n" +
                "\t\t\t\"item\": [\t\n" +
                "\t\t\t\t{\n" +
                "\t\t\t\t\t\"name\": \"邮件触发接口\",\n" +
                "\t\t\t\t\t\"request\": {\n" +
                "\t\t\t\t\t\t\"method\": \"GET\",\n" +
                "\t\t\t\t\t\t\"header\": [\n" +
                "\t\t\t\t\t\t\t{\n" +
                "\t\t\t\t\t\t\t\t\"key\": \"Authorization\",\n" +
                "\t\t\t\t\t\t\t\t\"value\": \"{{Authorization}}\",\n" +
                "\t\t\t\t\t\t\t\t\"type\": \"text\"\n" +
                "\t\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t\t],\n" +
                "\t\t\t\t\t\t\"url\": {\n" +
                "\t\t\t\t\t\t\t\"raw\": \"http://front.audi-qa.com/api/kpi_alarm/send_email?type=5\",\n" +
                "\t\t\t\t\t\t\t\"protocol\": \"http\",\n" +
                "\t\t\t\t\t\t\t\"host\": [\n" +
                "\t\t\t\t\t\t\t\t\"front\",\n" +
                "\t\t\t\t\t\t\t\t\"audi-qa\",\n" +
                "\t\t\t\t\t\t\t\t\"com\"\n" +
                "\t\t\t\t\t\t\t],\n" +
                "\t\t\t\t\t\t\t\"path\": [\n" +
                "\t\t\t\t\t\t\t\t\"api\",\n" +
                "\t\t\t\t\t\t\t\t\"kpi_alarm\",\n" +
                "\t\t\t\t\t\t\t\t\"send_email\"\n" +
                "\t\t\t\t\t\t\t],\n" +
                "\t\t\t\t\t\t\t\"query\": [\n" +
                "\t\t\t\t\t\t\t\t{\n" +
                "\t\t\t\t\t\t\t\t\t\"key\": \"type\",\n" +
                "\t\t\t\t\t\t\t\t\t\"value\": \"5\"\n" +
                "\t\t\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t\t\t]\n" +
                "\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t},\n" +
                "\t\t\t\t\t\"response\": []\n" +
                "\t\t\t\t},\n" +
                "\t\t\t\t{\n" +
                "\t\t\t\t\t\"name\": \"reports to detail 数据同步\",\n" +
                "\t\t\t\t\t\"request\": {\n" +
                "\t\t\t\t\t\t\"method\": \"GET\",\n" +
                "\t\t\t\t\t\t\"header\": [\n" +
                "\t\t\t\t\t\t\t{\n" +
                "\t\t\t\t\t\t\t\t\"key\": \"Authorization\",\n" +
                "\t\t\t\t\t\t\t\t\"value\": \"{{Authorization}}\",\n" +
                "\t\t\t\t\t\t\t\t\"type\": \"text\"\n" +
                "\t\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t\t],\n" +
                "\t\t\t\t\t\t\"url\": {\n" +
                "\t\t\t\t\t\t\t\"raw\": \"http://front.audi-qa.com/api/spot_plan_management/schedule/changeImpAndClick?start_date=2021-11-12&end_date=2021-11-13\",\n" +
                "\t\t\t\t\t\t\t\"protocol\": \"http\",\n" +
                "\t\t\t\t\t\t\t\"host\": [\n" +
                "\t\t\t\t\t\t\t\t\"front\",\n" +
                "\t\t\t\t\t\t\t\t\"audi-qa\",\n" +
                "\t\t\t\t\t\t\t\t\"com\"\n" +
                "\t\t\t\t\t\t\t],\n" +
                "\t\t\t\t\t\t\t\"path\": [\n" +
                "\t\t\t\t\t\t\t\t\"api\",\n" +
                "\t\t\t\t\t\t\t\t\"spot_plan_management\",\n" +
                "\t\t\t\t\t\t\t\t\"schedule\",\n" +
                "\t\t\t\t\t\t\t\t\"changeImpAndClick\"\n" +
                "\t\t\t\t\t\t\t],\n" +
                "\t\t\t\t\t\t\t\"query\": [\n" +
                "\t\t\t\t\t\t\t\t{\n" +
                "\t\t\t\t\t\t\t\t\t\"key\": \"start_date\",\n" +
                "\t\t\t\t\t\t\t\t\t\"value\": \"2021-11-12\"\n" +
                "\t\t\t\t\t\t\t\t},\n" +
                "\t\t\t\t\t\t\t\t{\n" +
                "\t\t\t\t\t\t\t\t\t\"key\": \"end_date\",\n" +
                "\t\t\t\t\t\t\t\t\t\"value\": \"2021-11-13\"\n" +
                "\t\t\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t\t\t]\n" +
                "\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t},\n" +
                "\t\t\t\t\t\"response\": []\n" +
                "\t\t\t\t},\n" +
                "\t\t\t\t{\n" +
                "\t\t\t\t\t\"name\": \"营销概览刷数\",\n" +
                "\t\t\t\t\t\"protocolProfileBehavior\": {\n" +
                "\t\t\t\t\t\t\"disableBodyPruning\": true\n" +
                "\t\t\t\t\t},\n" +
                "\t\t\t\t\t\"request\": {\n" +
                "\t\t\t\t\t\t\"method\": \"GET\",\n" +
                "\t\t\t\t\t\t\"header\": [\n" +
                "\t\t\t\t\t\t\t{\n" +
                "\t\t\t\t\t\t\t\t\"key\": \"Authorization\",\n" +
                "\t\t\t\t\t\t\t\t\"value\": \"{{Authorization}}\",\n" +
                "\t\t\t\t\t\t\t\t\"type\": \"text\"\n" +
                "\t\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t\t],\n" +
                "\t\t\t\t\t\t\"body\": {\n" +
                "\t\t\t\t\t\t\t\"mode\": \"raw\",\n" +
                "\t\t\t\t\t\t\t\"raw\": \"\",\n" +
                "\t\t\t\t\t\t\t\"options\": {\n" +
                "\t\t\t\t\t\t\t\t\"raw\": {\n" +
                "\t\t\t\t\t\t\t\t\t\"language\": \"json\"\n" +
                "\t\t\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t\t},\n" +
                "\t\t\t\t\t\t\"url\": {\n" +
                "\t\t\t\t\t\t\t\"raw\": \"https://audi.apps.n1q.cn/api/audi_marketing_effect_statistics/statistics\",\n" +
                "\t\t\t\t\t\t\t\"protocol\": \"https\",\n" +
                "\t\t\t\t\t\t\t\"host\": [\n" +
                "\t\t\t\t\t\t\t\t\"audi\",\n" +
                "\t\t\t\t\t\t\t\t\"apps\",\n" +
                "\t\t\t\t\t\t\t\t\"n1q\",\n" +
                "\t\t\t\t\t\t\t\t\"cn\"\n" +
                "\t\t\t\t\t\t\t],\n" +
                "\t\t\t\t\t\t\t\"path\": [\n" +
                "\t\t\t\t\t\t\t\t\"api\",\n" +
                "\t\t\t\t\t\t\t\t\"audi_marketing_effect_statistics\",\n" +
                "\t\t\t\t\t\t\t\t\"statistics\"\n" +
                "\t\t\t\t\t\t\t]\n" +
                "\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t},\n" +
                "\t\t\t\t\t\"response\": []\n" +
                "\t\t\t\t},\n" +
                "\t\t\t\t{\n" +
                "\t\t\t\t\t\"name\": \"生命周期转化漏斗自定义画像调用接口\",\n" +
                "\t\t\t\t\t\"request\": {\n" +
                "\t\t\t\t\t\t\"method\": \"GET\",\n" +
                "\t\t\t\t\t\t\"header\": [\n" +
                "\t\t\t\t\t\t\t{\n" +
                "\t\t\t\t\t\t\t\t\"key\": \"Authorization\",\n" +
                "\t\t\t\t\t\t\t\t\"value\": \"{{Authorization}}\",\n" +
                "\t\t\t\t\t\t\t\t\"type\": \"text\"\n" +
                "\t\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t\t],\n" +
                "\t\t\t\t\t\t\"url\": {\n" +
                "\t\t\t\t\t\t\t\"raw\": \"https://audi.apps.n1q.cn/api/tgi/getter?filters[audienceId]=10000087&filters[flat]=10&filters[type]=mm&filters[platform]=mobile\",\n" +
                "\t\t\t\t\t\t\t\"protocol\": \"https\",\n" +
                "\t\t\t\t\t\t\t\"host\": [\n" +
                "\t\t\t\t\t\t\t\t\"audi\",\n" +
                "\t\t\t\t\t\t\t\t\"apps\",\n" +
                "\t\t\t\t\t\t\t\t\"n1q\",\n" +
                "\t\t\t\t\t\t\t\t\"cn\"\n" +
                "\t\t\t\t\t\t\t],\n" +
                "\t\t\t\t\t\t\t\"path\": [\n" +
                "\t\t\t\t\t\t\t\t\"api\",\n" +
                "\t\t\t\t\t\t\t\t\"tgi\",\n" +
                "\t\t\t\t\t\t\t\t\"getter\"\n" +
                "\t\t\t\t\t\t\t],\n" +
                "\t\t\t\t\t\t\t\"query\": [\n" +
                "\t\t\t\t\t\t\t\t{\n" +
                "\t\t\t\t\t\t\t\t\t\"key\": \"filters[audienceId]\",\n" +
                "\t\t\t\t\t\t\t\t\t\"value\": \"10000087\"\n" +
                "\t\t\t\t\t\t\t\t},\n" +
                "\t\t\t\t\t\t\t\t{\n" +
                "\t\t\t\t\t\t\t\t\t\"key\": \"filters[flat]\",\n" +
                "\t\t\t\t\t\t\t\t\t\"value\": \"10\"\n" +
                "\t\t\t\t\t\t\t\t},\n" +
                "\t\t\t\t\t\t\t\t{\n" +
                "\t\t\t\t\t\t\t\t\t\"key\": \"filters[type]\",\n" +
                "\t\t\t\t\t\t\t\t\t\"value\": \"mm\"\n" +
                "\t\t\t\t\t\t\t\t},\n" +
                "\t\t\t\t\t\t\t\t{\n" +
                "\t\t\t\t\t\t\t\t\t\"key\": \"filters[platform]\",\n" +
                "\t\t\t\t\t\t\t\t\t\"value\": \"mobile\"\n" +
                "\t\t\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t\t\t]\n" +
                "\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t},\n" +
                "\t\t\t\t\t\"response\": []\n" +
                "\t\t\t\t},\n" +
                "\t\t\t\t{\n" +
                "\t\t\t\t\t\"name\": \"刷新生命周期转后阈值数据\",\n" +
                "\t\t\t\t\t\"request\": {\n" +
                "\t\t\t\t\t\t\"method\": \"GET\",\n" +
                "\t\t\t\t\t\t\"header\": [\n" +
                "\t\t\t\t\t\t\t{\n" +
                "\t\t\t\t\t\t\t\t\"key\": \"Authorization\",\n" +
                "\t\t\t\t\t\t\t\t\"value\": \"{{Authorization}}\",\n" +
                "\t\t\t\t\t\t\t\t\"type\": \"text\"\n" +
                "\t\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t\t],\n" +
                "\t\t\t\t\t\t\"url\": {\n" +
                "\t\t\t\t\t\t\t\"raw\": \"http://front.audi-qa.com/api/life_cycle_transition/threshold\",\n" +
                "\t\t\t\t\t\t\t\"protocol\": \"http\",\n" +
                "\t\t\t\t\t\t\t\"host\": [\n" +
                "\t\t\t\t\t\t\t\t\"front\",\n" +
                "\t\t\t\t\t\t\t\t\"audi-qa\",\n" +
                "\t\t\t\t\t\t\t\t\"com\"\n" +
                "\t\t\t\t\t\t\t],\n" +
                "\t\t\t\t\t\t\t\"path\": [\n" +
                "\t\t\t\t\t\t\t\t\"api\",\n" +
                "\t\t\t\t\t\t\t\t\"life_cycle_transition\",\n" +
                "\t\t\t\t\t\t\t\t\"threshold\"\n" +
                "\t\t\t\t\t\t\t]\n" +
                "\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t},\n" +
                "\t\t\t\t\t\"response\": []\n" +
                "\t\t\t\t}\n" +
                "\t\t\t]\n" +
                "\t\t},\n" +
                "\t\t{\n" +
                "\t\t\t\"name\": \"token获取\",\n" +
                "\t\t\t\"item\": [\n" +
                "\t\t\t\t{\n" +
                "\t\t\t\t\t\"name\": \"获取标准环境token\",\n" +
                "\t\t\t\t\t\"event\": [\n" +
                "\t\t\t\t\t\t{\n" +
                "\t\t\t\t\t\t\t\"listen\": \"test\",\n" +
                "\t\t\t\t\t\t\t\"script\": {\n" +
                "\t\t\t\t\t\t\t\t\"exec\": [\n" +
                "\t\t\t\t\t\t\t\t\t\"//将数据解析成json格式\\r\",\n" +
                "\t\t\t\t\t\t\t\t\t\"var data=JSON.parse(responseBody);\\r\",\n" +
                "\t\t\t\t\t\t\t\t\t\" \\r\",\n" +
                "\t\t\t\t\t\t\t\t\t\"//获取access_token值\\r\",\n" +
                "\t\t\t\t\t\t\t\t\t\"var access_token=data.access_token;\\r\",\n" +
                "\t\t\t\t\t\t\t\t\t\"\\r\",\n" +
                "\t\t\t\t\t\t\t\t\t\"//设置成环境变量\\r\",\n" +
                "\t\t\t\t\t\t\t\t\t\"pm.environment.set(\\\"Authorization\\\",\\\"Bearer  \\\"+access_token);\"\n" +
                "\t\t\t\t\t\t\t\t],\n" +
                "\t\t\t\t\t\t\t\t\"type\": \"text/javascript\"\n" +
                "\t\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t],\n" +
                "\t\t\t\t\t\"request\": {\n" +
                "\t\t\t\t\t\t\"method\": \"POST\",\n" +
                "\t\t\t\t\t\t\"header\": [],\n" +
                "\t\t\t\t\t\t\"body\": {\n" +
                "\t\t\t\t\t\t\t\"mode\": \"raw\",\n" +
                "\t\t\t\t\t\t\t\"raw\": \"{\\\"username\\\":\\\"huangdawei@mininglamp.com\\\",\\\"password\\\":\\\"1200.0..Hd\\\"}\",\n" +
                "\t\t\t\t\t\t\t\"options\": {\n" +
                "\t\t\t\t\t\t\t\t\"raw\": {\n" +
                "\t\t\t\t\t\t\t\t\t\"language\": \"json\"\n" +
                "\t\t\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t\t},\n" +
                "\t\t\t\t\t\t\"url\": {\n" +
                "\t\t\t\t\t\t\t\"raw\": \"http://front.audi-qa.com/api/oauth/login\",\n" +
                "\t\t\t\t\t\t\t\"protocol\": \"http\",\n" +
                "\t\t\t\t\t\t\t\"host\": [\n" +
                "\t\t\t\t\t\t\t\t\"front\",\n" +
                "\t\t\t\t\t\t\t\t\"audi-qa\",\n" +
                "\t\t\t\t\t\t\t\t\"com\"\n" +
                "\t\t\t\t\t\t\t],\n" +
                "\t\t\t\t\t\t\t\"path\": [\n" +
                "\t\t\t\t\t\t\t\t\"api\",\n" +
                "\t\t\t\t\t\t\t\t\"oauth\",\n" +
                "\t\t\t\t\t\t\t\t\"login\"\n" +
                "\t\t\t\t\t\t\t]\n" +
                "\t\t\t\t\t\t}\n" +
                "\t\t\t\t\t},\n" +
                "\t\t\t\t\t\"response\": []\n" +
                "\t\t\t\t}\n" +
                "\t\t\t]\n" +
                "\t\t}\n" +
                "\t]\n" +
                "}" ;
        JSONObject jsonObject=JSONObject.fromObject(str);
        JSONArray jsonArray= JSONArray.fromObject(jsonObject.get("items"));
        System.out.println(jsonArray);

    }
}
